<template>
  <div class="app-container">
    <my-data-table status="ALL" :isSafedeal="true" ref="dataTable">
      <el-table-column align="center" prop="dealcontract" label="安全承诺书" slot="operator" >
        <template slot-scope="scope">
          <el-button type="text" @click="getDealContract(scope.row)"  class="text-ellipsis">{{scope.row.name}}的安全承诺书</el-button>
        </template>
      </el-table-column>
    </my-data-table>
  </div>

</template>

<script>
import MyDataTable from '../worker/components/table.vue';
import { getProposalContracts  } from '@common/api/worker';

export default {
  components: {  MyDataTable },
  methods: {
    async getDealContract(row) { // 获取安全承诺书的查看地址TOTO
      const { data } = await getProposalContracts({ workerId: row.id });
      if (data?.contract?.FlowId) {
        this.$router.push(`/contract/detail/${data.contract.FlowId}`);
      } else {
        this.$message({ message: '获取合同信息失败', type: 'warning' });
      }
    },
  },

};
</script>
<style scoped>
.top-filter {
  margin-bottom: 20px;
}
</style>
